<UserControl x:Class="Microsoft.PowerShell.CmdletManagement.PsSpecCmdletParameterControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Microsoft.PowerShell.CmdletManagement" 
    x:Name="root"
    >
    <UserControl.Resources>
        <local:ArrayConverter x:Key="ArrayConverter" />
    </UserControl.Resources>
    
    <StackPanel>
        <GroupBox Header="{Binding Path=Name}">
            <StackPanel>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />                        
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <local:ExtendedTextBlock x:Name="ParameterName" Label="Parameter Name"
                                             Value="{Binding Path=Name, Mode=TwoWay}"
                                             HelpText="The name of the parameter" 
                                             Grid.Row="0" Grid.Column="0" />
                    <local:ExtendedTextBlock x:Name="ParameterType" Label="Parameter Type"
                                             Value="{Binding Path=Type, Mode=TwoWay}"
                                             HelpText="The .NET datatype of this parameter" 
                                             Grid.Row="0" Grid.Column="1" />
                    <local:FreeTextExtendedTextBlock x:Name="Description" Label="Description"
                                             HelpText="A short description of what this parameter means"
                                             Value="{Binding Path=Description, Mode=TwoWay}"
                                             Grid.Row="1" Grid.ColumnSpan="2" MinLines="5"/>
                    <local:FreeTextExtendedTextBlock x:Name="HelpDescription" Label="Help Description"
                                             HelpText="A help-specific short description of what this parameter means"
                                             Value="{Binding Path=HelpDescription, Mode=TwoWay}"
                                             Grid.Row="2" Grid.ColumnSpan="2" MinLines="5"/>
                    <local:FreeTextExtendedTextBlock x:Name="Notes" Label="Notes"
                                             HelpText="Any additional notes for this parameter"
                                             Value="{Binding Path=Notes, Mode=TwoWay}"
                                             Grid.Row="3" Grid.ColumnSpan="2" MinLines="5"/>
                </Grid>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <local:ExtendedTextBlock x:Name="Position" Label="Position"
                                             Value="{Binding Path=Position, Mode=TwoWay}"
                                             HelpText="The position of the parameter"
                                             WarningValue="&lt;Varies by parameter set&gt;" 
                                             Grid.Row="0" Grid.Column="0" />
                    <local:ExtendedTextBlock x:Name="DefaultValue" Label="Default Value"
                                             Value="{Binding Path=DefaultValue, Mode=TwoWay}"
                                             HelpText="The default value of the parameter"
                                             Grid.Row="0" Grid.Column="1" />
                    <local:ExtendedTextBlock x:Name="Aliases" Label="Aliases"
                                             Value="{Binding Path=Alias, Mode=TwoWay, Converter={StaticResource ArrayConverter}}"
                                             HelpText="The aliases for this parameter"
                                             Grid.Row="1" Grid.Column="0" />
                    <local:ExtendedCheckBox  x:Name="IsDynamic" Label="Is Dynamic"
                                             Value="{Binding Path=IsDynamic, Mode=TwoWay}"
                                             HelpText="This parameter is defined dynamically by the cmdlet"
                                             Grid.Row="1" Grid.Column="1" />

                    <local:ExtendedCheckBox  x:Name="Mandatory" Label="Mandatory"
                                             Value="{Binding Path=Mandatory, Mode=TwoWay}"
                                             HelpText="Is this parameter mandatory?"
                                             Grid.Row="2" Grid.Column="0" />
                    <local:ExtendedCheckBox  x:Name="ValueFromPipeline" Label="Value From Pipeline"
                                             Value="{Binding Path=ValueFromPipeline, Mode=TwoWay}"
                                             HelpText="This parameter accepts its value from the pipeline"
                                             Grid.Row="2" Grid.Column="1" />
                    <local:ExtendedCheckBox  x:Name="ValueFromPipelineByPropertyName" Label="Value From Pipeline By Property Name"
                                             Value="{Binding Path=ValueFromPipelineByPropertyName, Mode=TwoWay}"
                                             HelpText="This parameter accepts its value from the pipeline by property name"
                                             Grid.Row="3" Grid.Column="0" />
                    <local:ExtendedCheckBox  x:Name="ValueFromRemainingArguments" Label="Value From Remaining Arguments"
                                             Value="{Binding Path=ValueFromRemainingArguments, Mode=TwoWay}"
                                             HelpText="This parameter accepts its value from the remaining arguments"
                                             Grid.Row="3" Grid.Column="1" />
                    <local:ParameterSetGroupingEditor
                        x:Name="Parameters"
                        LostFocus="LostFocus_Parameters"
                        Value="{Binding Path=ParameterSets, Mode=OneWay}" 
                        Grid.Row="4" Grid.Column="0" />
                </Grid>
                <!--StackPanel>
                    <local:ParameterSetGroupingEditor 
                        x:Name="Parameters"
                        LostFocus="LostFocus_Parameters" 
                        Value="{Binding Path=ParameterSets, Mode=OneWay}" />
                </StackPanel-->
                <Expander IsExpanded="False" Header="Validation Attributes">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <local:ExtendedCheckBox x:Name="AllowGlobbing" Label="AllowGlobbing"
                                                 Value="{Binding Path=AllowGlobbing, Mode=TwoWay}"
                                                 HelpText="Can the user supply wildcards to this parameter?"
                                                 Grid.Row="0" Grid.Column="0" />
                        <local:ExtendedCheckBox x:Name="AllowEmptyCollection" Label="AllowEmptyCollection"
                                                 Value="{Binding Path=AllowEmptyCollection, Mode=TwoWay}"
                                                 HelpText="Can the user provide a collection of zero elements?"
                                                 Grid.Row="0" Grid.Column="1" />
                        <local:ExtendedCheckBox x:Name="AllowEmptyString" Label="AllowEmptyString"
                                                 Value="{Binding Path=AllowEmptyString, Mode=TwoWay}"
                                                 HelpText="Can the user provide an empty (but not null) string?"
                                                 Grid.Row="1" Grid.Column="0" />
                        <local:ExtendedCheckBox x:Name="AllowNull" Label="AllowNull"
                                                 Value="{Binding Path=AllowNull, Mode=TwoWay}"
                                                 HelpText="Can the user provide a null value?"
                                                 Grid.Row="1" Grid.Column="1" />
                        <local:ExtendedTextBlock x:Name="ValidateCount" Label="ValidateCount"
                                                 Value="{Binding Path=ValidateCount, Mode=TwoWay, Converter={StaticResource ArrayConverter}}"
                                                 HelpText="The minimum and maximum number of elements in a collection parameter. For example: 0,10"
                                                 Grid.Row="2" Grid.Column="0" />
                        <local:ExtendedCheckBox x:Name="ValidateNotNull" Label="ValidateNotNull"
                                                 Value="{Binding Path=ValidateNotNull, Mode=TwoWay}"
                                                 HelpText="Prevent the user from providing a null value?"
                                                 Grid.Row="2" Grid.Column="1" />
                        <local:ExtendedCheckBox x:Name="ValidateNotNullOrEmpty" Label="ValidateNotNullOrEmpty"
                                                 Value="{Binding Path=ValidateNotNullOrEmpty, Mode=TwoWay}"
                                                 HelpText="Prevent the user from providing a null or empty value?"
                                                 Grid.Row="3" Grid.Column="0" />
                        <local:ExtendedTextBlock x:Name="ValidateRange" Label="ValidateRange"
                                                 Value="{Binding Path=ValidateRange, Mode=TwoWay, Converter={StaticResource ArrayConverter}}"
                                                 HelpText="The minimum and maximum values a integer parameter may have. For example: 1,10"
                                                 Grid.Row="3" Grid.Column="1" />
                        <local:ExtendedTextBlock x:Name="ValidateSet" Label="ValidateSet"
                                                 Value="{Binding Path=ValidateSet, Mode=TwoWay, Converter={StaticResource ArrayConverter}}"
                                                 HelpText="The different possible values a string parameter may take. For example: Red,Green,Blue"
                                                 Grid.Row="4" Grid.Column="0" />
                        <local:ExtendedTextBlock x:Name="ValidateLength" Label="ValidateLength"
                                                 Value="{Binding Path=ValidateLength, Mode=TwoWay, Converter={StaticResource ArrayConverter}}"
                                                 HelpText="The minimum and maximum length a string parameter may have. For example: 1,50"
                                                 Grid.Row="4" Grid.Column="1" />
                        <local:ExtendedTextBlock x:Name="ValidatePattern" Label="ValidatePattern"
                                                 Value="{Binding Path=ValidatePattern, Mode=TwoWay}"
                                                 HelpText="The regular expression pattern this string parameter must match. For example: ^[a-zA-Z0-9]*$"
                                                 Grid.Row="5" Grid.Column="0" />
                    </Grid>
                </Expander>
                <Expander IsExpanded="False" Header="Custom Fields">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <local:ExtendedTextBlock x:Name="Custom1" Label="Custom Field #1"
                                                        HelpText="Data associated with custom field #1"
                                                        Value="{Binding Path=Custom1, Mode=TwoWay}"
                                                        Grid.Row="0" Grid.Column="0"
                                                />
                        <local:ExtendedTextBlock x:Name="Custom2" Label="Custom Field #2"
                                                        HelpText="Data associated with custom field #2"
                                                        Value="{Binding Path=Custom2, Mode=TwoWay}"
                                                        Grid.Row="0" Grid.Column="1"
                                                />
                        <local:ExtendedTextBlock x:Name="Custom3" Label="Custom Field #3"
                                                        HelpText="Data associated with custom field #3"
                                                        Value="{Binding Path=Custom3, Mode=TwoWay}"
                                                        Grid.Row="1" Grid.Column="0"
                                                />
                        <local:ExtendedTextBlock x:Name="Custom4" Label="Custom Field #4"
                                                        HelpText="Data associated with custom field #4"
                                                        Value="{Binding Path=Custom4, Mode=TwoWay}"
                                                        Grid.Row="1" Grid.Column="1"
                                                />

                    </Grid>
                </Expander>            
            </StackPanel>
        </GroupBox>
    </StackPanel>
</UserControl>